package com.blog.service.impl;

import com.blog.bean.ArticleCategory;
import com.blog.mapper.ArticleCategoryMapper;
import com.blog.service.ArticleCategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ArticleCategoryServiceImpl implements ArticleCategoryService {

    @Resource
    private ArticleCategoryMapper articleCategoryMapper;
    
    @Override
    public int deleteByPrimaryKey(Long articleCategoryId) {
        return articleCategoryMapper.deleteByPrimaryKey(articleCategoryId);
    }

    @Override
    public int insert(ArticleCategory record) {
        return articleCategoryMapper.insert(record);
    }

    @Override
    public int insertSelective(ArticleCategory record) {
        return articleCategoryMapper.insertSelective(record);
    }

    @Override
    public ArticleCategory selectByPrimaryKey(Long articleCategoryId) {
        return articleCategoryMapper.selectByPrimaryKey(articleCategoryId);
    }

    @Override
    public int updateByPrimaryKeySelective(ArticleCategory record) {
        return articleCategoryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(ArticleCategory record) {
        return articleCategoryMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<ArticleCategory> selectArticleCategory(ArticleCategory articleCategory) {
        return articleCategoryMapper.selectArticleCategory(articleCategory);
    }

    @Override
    public ArticleCategory getArticleCategory(ArticleCategory articleCategory) {
        List<ArticleCategory> list = this.selectArticleCategory(articleCategory);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }
}
